package com.softa.web.controller.system;

import com.softa.annotation.CurrentUser;
import com.softa.cache.util.RedisUitl;
import com.softa.dao.mapper.base.SysBaseMapper;
import com.softa.dao.mapper.relation.system.SysBaseRelationMapper;
import com.softa.dao.model.SysBase;
import com.softa.service.system.SysBaseService;
import com.softa.web.controller.base.BaseController;
import com.softa.utils.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by yangl on 2017/7/29.
 * 基础信息设置
 */
@Controller
@RequestMapping("/baseinfo")
public class BaseInfoController extends BaseController {

    @Resource
    private SysBaseService sysBaseService;

    @RequestMapping(method = RequestMethod.GET)
    public String list(Model model) {
        return Constants.MENU_MANAGE+"/baseinfo/list";
    }

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    @ResponseBody
    public String create(SysBase sysBase) {
        String message="录入成功";
        try {
            message=sysBaseService.createSysBase(sysBase);
        } catch (Exception e) {
            message="录入失败";
            logger.error(e.getMessage());
        }
        return message;
    }
}
